
<%@page import="org.lxy.service.GoodsTypeService"%>
<%@page import="org.lxy.service.InfomationService"%>
<%@page import="org.lxy.service.RecyclePointService"%>
<%@page import="org.lxy.domain.GoodsTypeEntity"%>
<%@page import="org.lxy.domain.InfomationEntity"%>
<%@page import="org.lxy.domain.RecyclePointEntity"%>

<%@page import="org.lxy.service.RecycleGoodsService"%>
<%@page import="org.lxy.domain.RecycleGoodsEntity"%>
<%@ page language="java" import="java.util.*"
	contentType="text/html; charset=utf-8"%>
<%@ page import="org.springframework.web.context.WebApplicationContext" %>
<%@ page import="org.springframework.web.context.support.WebApplicationContextUtils" %>
<%@ page import="cn.hutool.core.bean.BeanUtil" %>
<%@ page import="org.lxy.utils.CoreUtils" %>
<%
	String path = request.getContextPath();
	String basePath = request.getScheme() + "://" + request.getServerName() + ":" + request.getServerPort()
			+ path + "/";
	WebApplicationContext context= WebApplicationContextUtils.getWebApplicationContext(application);

%>
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport"
	content="width=device-width, initial-scale=1, maximum-scale=1.0, user-scalable=no">
<title>闲置物品回收</title>
<meta name="keywords" content="HTML5,CSS3,HTML,Template,Themeton">
<meta name="description"
	content="Cloudy Town - Simple Blog HTML Template">
<meta name="author" content="Themeton">
<!-- Favicon -->
<link rel="shortcut icon" type="image/x-icon" href="/images/favicon.png" />
<!-- Fonts -->
<!-- Bootstrap -->
<link rel="stylesheet" type="text/css"
	href="/vendors/bootstrap/css/bootstrap.min.css">
<link rel="stylesheet" type="text/css"
	href="/vendors/bootstrap/css/bootstrap-theme.min.css">
<!-- Fontawesome -->
<link rel="stylesheet" type="text/css"
	href="/vendors/font-awesome/css/font-awesome.min.css">
<!-- Swiper -->
<link rel="stylesheet" type="text/css"
	href="/vendors/swiper/css/swiper.min.css">
<!-- Magnific-popup -->
<link rel="stylesheet" type="text/css" href="/style.css">
<link rel="stylesheet" type="text/css" href="/css/welcome.css">
<script type="text/javascript" src="/js/jquery-1.9.1.js"></script>
<script type="text/javascript" src="/js/kindeditor/kindeditor-all.js"></script>
<script type="text/javascript" src="/js/kindeditor/lang/zh-CN.js"></script>

<script>
	var editor;
	$(function() {
		editor = KindEditor.create('#neirong', {
			allowFileManager : true,
			resizeType : 1,
			minWidth : 500,
			minHeight : 210,
			items : [ 'source', '|', 'undo', 'redo', '|', 'preview', 'print',
					'template', 'cut', 'copy', 'paste', '|', 'justifyleft',
					'justifycenter', 'justifyright', '|', 'insertorderedlist',
					'insertunorderedlist', 'clearhtml', 'quickformat', '|',
					'anchor', 'link', 'unlink', '|', 'fullscreen', '/',
					'formatblock', 'fontname', 'fontsize', '|', 'forecolor',
					'hilitecolor', 'bold', 'italic', 'underline', 'lineheight',
					'removeformat', '|', 'image', 'multiimage', 'flash',
					'media', 'insertfile', '|', 'table', 'hr', 'emoticons',
					'baidumap' ],
			fileManagerJson : 'js/kindeditor/jsp/file_manager_json.jsp',
			//这里是指定的文件上传input的的属性名
			//filePostName: "uploadFile",
			//这里就是指定文件上传的请求地址，上面也已经说了，upload_json.jsp就相当去一个servlet去进行保存文件，这个地方很重要
			uploadJson : '/js/kindeditor/jsp/upload_json.jsp',
			resizeType : 1,
			allowPreviewEmoticons : true,
			allowImageUpload : true,
		});
	});

	function changeAddress() {
		var select= $("#select optinon:huishoudianid");//#select是select的id值
		var value = select.val();//获取选中的值
		var text = select.text();
		console.log(text);
		$('#dizhi').val(text);
	}

	function upload() {

		$("#PicLoad").click();
	}
	function change(file) {
		// var prevDiv = document.getEleme+ntById('img');
		if (file.files && file.files[0]) {
			var reader = new FileReader();

			reader.onload = function(evt) {
				var filepath = evt.target.result;

				var extStart = filepath.lastIndexOf(".");
				var ext = filepath.substring(extStart, filepath.length)
						.toUpperCase();
				////BMP、JPG、JPEG、PNG、GIF
				//if (ext != ".PNG" && ext != ".BMP" && ext != ".JPG" && ext != ".JPEG" && ext != ".GIF") {
				//    //提示信息
				//    alert(" 图片格式不正确！");
				//    return false;
				//}
				$("#img").attr("src", evt.target.result);
			}
			reader.readAsDataURL(file.files[0]);
		} else {
			//prevDiv.innerHTML = '<div class="img" style="filter:progid:DXImageTransform.Microsoft.AlphaImageLoader(sizingMethod=scale,src=\'' + file.value + '\'"></div>';
			alert($("#img").attr("src"));
			$("#img").attr("src", file.value);
			alert($("#img").attr("src"));
		}
	}
</script>
</head>
<body>
	<header id="header">
		<div class="logo" data-bg-image="/images/bg-header.jpg">
			<h1>
				<a href="Home.jsp">闲置物品回收</a>
			</h1>
			<p></p>
		</div>
		<div class="menu-container">
			<div class="container">
				<div class="row">
					<div class="col-md-7">
						<nav class="main-nav">
							<ul>
								<li class=" current-menu-item menu-item-has-children"><a
									href="/home">首页</a></li>
								<li><a href="/zixunlist">资讯</a></li>
								<li><a href="/huishouwulist">兑换物品</a></li>
								<li><a href="/shangmenhuishou">上门回收</a></li>
								<li><a href="/huishoudianhuishou">回收点回收</a></li>
								<li><a href="/wodejuanzengwu">我的捐赠物</a></li>
								<li><a href="/wodeduihuanwu">我的兑换物</a></li>
							</ul>
							<a href="javascript:;" id="close-menu"> <i
								class="fa fa-close"></i></a>
						</nav>
					</div>
					<div class=" col-md-5 h-search">
						<form class="search_form">
							<input type="text" name="2" placeholder="Search and hit enter...">
							<button type="submit">
								<i class="fa fa-search"></i>
							</button>
						</form>
					</div>
				</div>
			</div>
		</div>
	</header>
	<section class="section-content">
		<div class="container">
			<div class="row">
				<div class="col-sm-8 col-md-8">
					<article class="contact-media">
						<h2 class="contact-media-title">回收点回收</h2>
						<div class="bubble-line">
							<div class="left-shape">
								<svg version="1.1" xmlns="http://www.w3.org/2000/svg"
									xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
									viewBox="0 0 15 30" enable-background="new 0 0 15 30"
									xml:space="preserve">
            <path fill-rule="evenodd" clip-rule="evenodd" fill="none"
										stroke="#000000" stroke-miterlimit="10"
										d="M0,29.4c0,0,7.5,0,7.5-7c0,0,7,0,7-7c0-0.1,0-0.1,0-0.2c0-0.1,0-0.1,0-0.2c0-7-7-7-7-7c0-7-7.5-7-7.5-7"></path>
        </svg>
							</div>
							<div class="right-shape">
								<svg version="1.1" xmlns="http://www.w3.org/2000/svg"
									xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
									viewBox="0 0 15 30" enable-background="new 0 0 15 30"
									xml:space="preserve">
            <path fill-rule="evenodd" clip-rule="evenodd" fill="none"
										stroke="#000000" stroke-miterlimit="10"
										d="M15,29.4c0,0-7.5,0-7.5-7c0,0-7,0-7-7c0-0.1,0-0.1,0-0.2c0-0.1,0-0.1,0-0.2c0-7,7-7,7-7c0-7,7.5-7,7.5-7"></path>
        </svg>
							</div>
						</div>
						<div class="contact-content">
							<div class="contact-row">
								<form action="/recyclegoods/editGoods" method="post"
                                      enctype="multipart/form-data">
		<input type="hidden" value="回收点回收" name="huishoufangshi"/>
									<div class="contact-form">
										<p>类型：</p>
										<select name="leixingid">
										<%
											GoodsTypeService goodsTypeService = context.getBean(GoodsTypeService.class);
											List<GoodsTypeEntity> leixinglist = goodsTypeService.list();
								
								for(GoodsTypeEntity leixing:leixinglist){
									%>
									<option value=<%=leixing.getId()%>><%=leixing.getName() %></option>
									<%
								}
								%></select>
										<p>名称：</p>
										<input type="text" id="mingcheng" name="mingcheng" />
										<p>简介：</p>
										<textarea id="jieshao" name="jieshao"></textarea>
										<p>图片：</p>
										<img id="img" style="width: 100%; height: 200px;"
						src="" onclick="upload()" /> <input
						type="file" name="tupian" id="PicLoad" style="display: none;"
						onchange="change(this)">
					
										
										<p>回收点：</p>
										<select name="huishoudianid">
										<%
											RecyclePointService recyclePointService = context.getBean(RecyclePointService.class);
											List<RecyclePointEntity> list = recyclePointService.list();
										for (RecyclePointEntity item : list) {
									%>
									<option  value=<%=item.getId()%>><%=item.getName()%></option>
									<%
								}
								%></select><p>所需积分：</p>
										<input type="text" id="xuyaojifen" name="xuyaojifen"/>
									</div>
									<div class="contact-submit">
									<input type="submit" class="button" value="提交"/>
										
									</div>
								</form>
							</div>
						</div>
					</article>
				</div>
				<div class="col-sm-4 sidebar">
					<div class="widget">
						<h3 class="widget-title">回收点</h3>
						<div class="bubble-line"></div>
						<div class="widget-content">
							<ul>
								<%
									for (RecyclePointEntity item : list) {
								%>
								<li>
								<p style="margin-top:0px;"><a href="javascript:;"> <%=item.getName()%></a></p>
								 <p style="float: right;line-height: 25px;margin-top:0px;"><%=item.getAddress()%></p>
								<div style="clear:both"></div>
								</li>
								<%
									}
								%>
							</ul>
						</div>
					</div>
					<div class="widget">
						<h3 class="widget-title">物品兑换</h3>
						<div class="bubble-line"></div>
						<div class="widget-content">
							<%
								RecycleGoodsService recycleGoodsService = context.getBean(RecycleGoodsService.class);
								List<RecycleGoodsEntity> wupinlist = recycleGoodsService.listByMap(CoreUtils.toMap(RecycleGoodsEntity.builder().status("兑换中").build()));
								for (RecycleGoodsEntity item : wupinlist) {
							%>
							<div class="widget-recent">
								<img src="<%=item.getImg() %>" alt="not image">
								<h4>
									<a href="javascript:;"><%=item.getName()%></a>
								</h4>
							</div>
							<%
								}
							%>
						</div>
					</div>
					<div class="widget widget-sub">
						<h5>闲物置换，互利共赢</h5>
						<p>想变废为宝吗？那还等什么？一起换吧，换的舒心，换的开心，换的放心。</p>
					<br/>
					<p>失去一些，得到一些，谁赚到全世界，一起换吧，换客的彩虹天堂！</p>
					</div>
					<div class="widget-sub social">
						<ul>
							<%
								for (GoodsTypeEntity item : leixinglist) {
									int count = recycleGoodsService.listByMap(BeanUtil.beanToMap(RecycleGoodsEntity.builder().typeId(item.getId()).build(),true,true)).size();
							%>
							<li><a class="social-widget" href="javascript:;"> <i
									class="fa fa-twitter"></i> <span><%=item.getName()%></span></a>
								<div><%=count%></div></li>
							<%
								}
							%>
						</ul>
					</div>
				</div>
				</div>
		</div>
	</section>
	<footer id="footer">
		<div class="footer-slide">
			<div class="swiper-container">
				<div class="swiper-wrapper">
					<div
						class="swiper-slide fslide col-xs-6 col-sm-4 col-md-3 col-lg-2">
						<a href="#" class="thumbnails"><img
							src="images/footer/photos2.jpg" alt="Image"></a>
					</div>
					<div
						class="swiper-slide fslide col-xs-6 col-sm-4 col-md-3 col-lg-2">
						<a href="#" class="thumbnails"><img
							src="images/footer/photos1.jpg" alt="Image"></a>
					</div>
					<div
						class="swiper-slide fslide col-xs-6 col-sm-4 col-md-3 col-lg-2">
						<a href="#" class="thumbnails"><img
							src="images/footer/01-footer.jpg" alt="Image"></a>
					</div>
					<div
						class="swiper-slide fslide col-xs-6 col-sm-4 col-md-3 col-lg-2">
						<a href="#" class="thumbnails"><img
							src="images/footer/02-footert.jpg" alt="Image"></a>
					</div>
					<div
						class="swiper-slide fslide col-xs-6 col-sm-4 col-md-3 col-lg-2">
						<a href="#" class="thumbnails"><img
							src="images/footer/photos4.jpg" alt="Image"></a>
					</div>
					<div
						class="swiper-slide fslide col-xs-6 col-sm-4 col-md-3 col-lg-2">
						<a href="#" class="thumbnails"><img
							src="images/footer/photos5.jpg" alt="Image"></a>
					</div>
					<div
						class="swiper-slide fslide col-xs-6 col-sm-4 col-md-3 col-lg-2">
						<a href="#" class="thumbnails"><img
							src="images/footer/photos7.jpg" alt="Image"></a>
					</div>
					<div
						class="swiper-slide fslide col-xs-6 col-sm-4 col-md-3 col-lg-2">
						<a href="#" class="thumbnails"><img
							src="images/footer/photos6.jpg" alt="Image"></a>
					</div>
				</div>
				<div class="swiper-button-prev circle-arrow">
					<i class="fa fa-chevron-left"></i>
				</div>
				<div class="swiper-button-next circle-arrow">
					<i class="fa fa-chevron-right"></i>
				</div>
			</div>
		</div>
		<div class="sub-footer">
			<div class="container">
				<div class="row">
					<div class="col-sm-12">
						<div class="widget"></div>
						<div class="widget footer-cp-text"></div>
					</div>
				</div>
			</div>
		</div>
	</footer>
	<!-- Include jQuery and Scripts -->
	<script type="text/javascript" src="/js/jquery.min.js"></script>
	<script type="text/javascript"
		src="/vendors/bootstrap/js/bootstrap.min.js"></script>
	<script type="text/javascript" src="/vendors/jquery.waypoints.min.js"></script>
	<script type="text/javascript" src="/vendors/isotope.pkgd.min.js"></script>
	<!-- Swiper -->
	<script type="text/javascript" src="/vendors/swiper/js/swiper.min.js"></script>
	<!-- Magnific-popup -->
	<script type="text/javascript" src="/js/scripts.js"></script>
</body>
</html>
